<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <title></title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <link rel="stylesheet" href="/cms/css/font.css">
  <link rel="stylesheet" href="/cms/css/xadmin.css">
  <link rel="stylesheet" href="/cms/layui/css/layui.css">
  <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
  <!--[if lt IE 9]>
  <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
  <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
  <![endif]-->
</head>

<body class="form-wrap">

<div class="layui-fluid">
  <div class="layui-row layui-col-space15">

    <div class="layui-col-md12">
      <div class="layui-card">
        <div class="layui-card-header">分类信息</div>
        <div class="layui-card-body">
          <form class="layui-form">
            <div class="layui-row layui-col-space10 layui-form-item">
              <div class="layui-col-lg6">
                <label class="layui-form-label">分类名称：</label>
                <div class="layui-input-block">
                  <input type="text" name="categoryName" lay-verify="required"
                         placeholder="" autocomplete="off"
                         class="layui-input">
                </div>
              </div>
              <div class="layui-col-lg6">
                <label class="layui-form-label">分类描述：</label>
                <div class="layui-input-block">
                  <input type="text" name="categoryDesc"  lay-verify="required"
                         placeholder="" autocomplete="off"
                         class="layui-input">
                </div>
              </div>
            </div>

            <div class="layui-form-item">
              <div class="layui-input-block">
                <button class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
              </div>
            </div>
          </form>
        </div>
      </div>
    </div>
  </div>
</div>
</div>
</div>

<script type="text/javascript" src="/js/jquery.min.js"></script>
<script src="/cms/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript" src="/cms/js/xadmin.js"></script>
<script>
  layui.use(['form', 'upload', 'laydate'], function () {
    var form = layui.form,
        layer = layui.layer;
    var $ = layui.$;

    //监听提交
    form.on('submit(demo1)', function (data) {
      layer.msg(JSON.stringify(data.field));
      $.ajax({
        url: '/cms/category/edit',
        type: 'POST',
        dataType: 'JSON',
        contentType: "application/json;charset=UTF-8",
        data: JSON.stringify(data.field),
        success: function (result) {
          if (result.code == 200) {
            layer.msg(result.msg);
            // x_admin_close()
            return false;
          } else {
            layer.msg(result.msg);
            return false;
          }
        }
      });
      return false;
    });
  });
</script>
</body>


</html>